package com.biaoyoo.www.personapp.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.biaoyoo.www.personapp.R;
import com.biaoyoo.www.personapp.constant.ConstantValue;
import com.biaoyoo.www.personapp.core.AppStateTrack;
import com.biaoyoo.www.personapp.utils.SPUtils;

public class LoginActivity extends BaseActivity implements View.OnClickListener {

    private Button mLoginBtn;
    private EditText mUserEt,mPwdEt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void loadViews() {
        setContentView(R.layout.activity_login,R.string.login_activity);
        mLoginBtn = (Button) findViewById(R.id.btn_login);
        mUserEt = (EditText) findViewById(R.id.et_user);
        mPwdEt = (EditText) findViewById(R.id.et_pwd);
        mLoginBtn.setOnClickListener(this);
    }

    @Override
    protected void initDatas() {

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_login:
                String userName = mUserEt.getText().toString();
                String pad = mPwdEt.getText().toString();

                if("123".equals(userName)&&"321".equals(pad)){
                    AppStateTrack.getInstance().setmCurentState(ConstantValue.STATE_ONLINE);
                    SPUtils.put("islogin",true);
                    lanchGoalActivity(MainActivity.class);
                }
                break;
        }
    }
}
